
module Installr::Manager
  class Base
    def initialize(log, options={})
      @log = log
      @options = options.dup
      @options[:manager_port] = '8080' unless @options[:manager_port]
      @options[:manager_user] = 'manager' unless @options[:manager_user]
      @options[:manager_password] = 'manager' unless @options[:manager_password]
      @options[:manager_timeout] = '600' unless @options[:manager_timeout]
    end

    def deploy(app_name)
      puts "[manager:deploy] deploy #{app_name}" if @options[:verbose]
      @log.info("[manager:deploy] deploy #{app_name}")
    end

    def undeploy(app_name)
      puts "[manager:undeploy] undeploy #{app_name}" if @options[:verbose]
      @log.info("manager:undeploy] undeploy #{app_name}")
    end

    def start(app_name)
      puts "[manager:start] start #{app_name}" if @options[:verbose]
      @log.info("[manager:start] start #{app_name}")
    end

    def stop(app_name)
      puts "[manager:stop] stop #{app_name}" if @options[:verbose]
      @log.info("[manager:stop] stop #{app_name}")
    end

    def reload(app_name)
      puts "[manager:reload] reload #{app_name}" if @options[:verbose]
      @log.info("[manager:reload] reload #{app_name}")
    end

    def list
      puts "[manager:list] list" if @options[:verbose]
      @log.info("[manager:list] list")
    end

    def serverinfo
      puts "[manager:serverinfo] serverinfo" if @options[:verbose]
      @log.info("[manager:serverinfo] serverinfo")
    end
  end
end
